/**
 * 负责支付相关的 API
 */

// 导入封装的 axios 实例
import instance from '@/utils/http'
import instancepay from '@/utils/httu'
import type { Ref } from 'vue'



export interface reqSubPayType{
    "codeUrl": string,
    "orderId": string,
    "totalFee": string,
    "resultCode": "SUCCESS"
}


/**
 * @desc https://www.showdoc.com.cn/2077491945864902/9443888348945332
 * @param {*} 提交订单
 * @returns Promise
 */
export const reqSubmitOrder = (data: { tradeNo:string}) => {
  return instance.post(`/api/order/auth/submitOrder?tradeNo=${data.tradeNo}`, data)
}

/**
 * @desc https://www.showdoc.com.cn/2077491945864902/9443888348945332
 * @param {*} 获取订单支付信息
 * @returns Promise
 */
export const reqSubPay = (id:string) => {
  return instance.get<any, any>(`/api/payment/weixin/createNative/${id}`)
}

/**
 *@desc https://www.showdoc.com.cn/2077491945864902/9444241600678120
 * @param {*} 查询订单支付状态
 * @returns Promise
 */
export const reqPayStatus = (id:string) => {
  return instancepay.get<any, any>(`/api/payment/weixin/queryPayStatus/${id}`)
}

/**
 *@desc https://www.showdoc.com.cn/2077491945864902/9444241600678120
 * @param {*}获取我的订单列表
 * @returns Promise
 */
export const reqPayList = (page:string, limit:string) => {
  return instance.get(`/api/order/auth/${page}/${limit}`)
}
